import tables, bitops, sequtils
type 
  Allergies* = object
    score*: int
let
  table = toOrderedTable {
    "eggs": 1,
    "peanuts": 2,
    "shellfish": 4,
    "strawberries": 8,
    "tomatoes": 16,
    "chocolate": 32,
    "pollen": 64,
    "cats": 128,
  }
  keys = toSeq(keys(table))

proc isAllergicTo*(person: Allergies, obj: string): bool = 
  bitand(person.score, table[obj]) != 0

proc lst*(person: Allergies): seq[string] =
  keys.filterIt(person.isAllergicTo(it))